import { _fetch } from '../api/request'
// import { getlocal } from '@/utils/local.js'

// 一进入页面获取搜索结果
function searchList (params) {
  return _fetch({
    url: '/v1_0/search',
    method: 'get',
    params: params
  })
}
// 联想
function suggestion (params) {
  return _fetch({
    url: '/v1_0/suggestion',
    method: 'get',
    params: params
  })
}
// 删除历史记录
function histories () {
  return _fetch({
    url: '/v1_0/search/histories',
    method: 'DELETE',
    needToken: true
  })
}

// 获取文章
function articles (id) {
  return _fetch({
    url: '/v1_0/articles/' + id,
    method: 'get'
  })
}
// 获取评论
function comments (params) {
  return _fetch({
    url: '/v1_0/comments',
    method: 'get',
    params
  })
}

export { searchList, suggestion, histories, articles, comments }
